<script lang="ts" setup>
import type { flowable, DialogModelFlowable } from '@/index.d';
import ProcessDefinitionTable from './ProcessDefinitionTable.vue';
import router from '@/router';

const dialogModel = defineModel<DialogModelFlowable>('processInstanceChooseDialogModel', {
  required: true
});

const openCreateProcessInstanceDialog = (processDefinitionVO: flowable.ProcessDefinitionVO) => {
  dialogModel.value.visible = false;
  router.push({
    path: `/flowable/form/${processDefinitionVO.processDefinitionKey}`
  });
};
</script>
<template>
  <hq-dialog-table-flowable v-model:dialog-model="dialogModel">
    <template #header> 选择您需要启动的流程</template>
    <template #default>
      <ProcessDefinitionTable
        @open-create-process-instance-dialog="openCreateProcessInstanceDialog"
      />
    </template>
  </hq-dialog-table-flowable>
</template>
<style lang="scss" scoped></style>
